package basis;


public class Main {
    public static void main(String[] args) {
        // 创建责任链
        Handler handlerA = new ConcreteHandlerA();
        Handler handlerB = new ConcreteHandlerB();
        Handler handlerC = new ConcreteHandlerC();

        // 设置责任链的顺序
        handlerA.setNextHandler(handlerB);
        handlerB.setNextHandler(handlerC);

        // 发起请求
        handlerA.handleRequest(5);
        System.out.println("-------------------");
        handlerA.handleRequest(15);
        System.out.println("-------------------");
        handlerA.handleRequest(25);
    }
}